<?php
if (!defined('ZAZA')) exit('No direct script access allowed');
/**
 * @copyright     ZaZa Group
 * @author        Sir Doan
 */
class Form
{
    public static $current = false;
    private static $name = false;
    public static $options = array();
    private static $isSubmit = false;
    function __construct($name = '')
    {
        self::$name = $name; 
        Form::$current = &$this;       
    }
    
    /**
     * Start form 
     * 
     * @param Boolean $upload Upload file
     * @param String $method Type submit
     * @param String $action Url
     * @return String
     * @access Public
     */
    public function begin($upload = false, $method = 'post', $action = false)
    {
        $html = '<form'. (self::$name ? ' name="'. self::$name .'"' : '') .' method="'. $method .'"'. ($upload ? ' enctype="multipart/form-data"' : '') . ($action ? ' action="'. $action .'"' : '') .'>';
        if(Module::$current)
            $html .= '<input type="hidden" name="formModuleId" value="'. Module::$current->data['moduleid'] .'" />';
        return $html;
    }
    
    /**
     * End form 
     * 
     * @return String
     * @access Public
     */
    public function end()
    {
        return '</form>';
    }
    
    /**
     * Submit Form 
     */
    public function isSubmit($arrOption = array())
    {
        if(!self::$isSubmit || !empty($arrOption)) 
        {
            self::$isSubmit = true;    
            if(Module::$current)
            {
                if(isset($_REQUEST['form_page_id']))
                {
                    
                }
            }
            
        }   
    }
}  
?>
